import usePlanningStore from "@/stores/planningStore.js";

const planningStore = usePlanningStore();

export default function () {
  if (planningStore.selectedStaffs.length > 0) {
    let workingDays = planningStore.planningDates.map((date) => ({
      date: date,
      tasks: [],
    }));

    let workingDaysJson = JSON.stringify(workingDays);

    planningStore.confirmedStaffs = planningStore.selectedStaffs.map(
      (item) => ({
        ...item,
        workingDays: JSON.parse(workingDaysJson),
      })
    );

    return true;
  }
  ElMessage.error("请先选择值班人员");
  return false;
}
